﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BLL;


namespace WebApplication.Admins.Controls
{
    public partial class UCQuanHuyen : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Display();

            }
            
        }
        public void Display()
        {
            repQuanHuyen.DataSource = Quan_HuyenBLL.LayTatCa();
            repQuanHuyen.DataBind();
            lblTen.Visible = false;
            txtTen.Visible = false;
            btnTim.Visible = false;
        }
        protected void btnXoa_Click(object sender, EventArgs e)
        {
            string Id = Request.Form["Id"] ?? "";
            if (Id != "")
            {
                foreach (string id in Id.Split(','))
                    Quan_HuyenBLL.Xoa(id);
                Display();
            }
        }

        protected void btnTimKiem_Click(object sender, EventArgs e)
        {
            lblTen.Visible = true;
            txtTen.Visible = true;
            btnTim.Visible = true;
            //Display();
        }

        protected void btnTim_Click(object sender, EventArgs e)
        {
            string timten = txtTen.Text.ToLower();
            if (timten.Length > 0)
            {
                //repQuanHuyen.DataSource = Quan_HuyenBLL.(timten);
                repQuanHuyen.DataBind();
            }
        }
     
    }
}